<%@page import="com.opensymphony.xwork2.ActionContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" isELIgnored="false"%>

<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
<script src="http://how2j.cn/study/js/jquery/2.0.0/jquery.min.js"></script>
<link href="http://how2j.cn/study/css/bootstrap/3.3.6/bootstrap.min.css" rel="stylesheet">
<script src="http://how2j.cn/study/js/bootstrap/3.3.6/bootstrap.min.js"></script>
<head>
<script type="text/javascript">
function objsubmin(){
	var objselectValue = "";
    var bookselectValue = "";
    var objflag = false;
    var objselect = document.getElementsByName("objselect");
    var bookselect = document.getElementsByName("bookseleck");
    for(i=0;i<objselect.length;i++)
        {
        if(objselect[i].checked){
                objselectValue+=","+objselect[i].value;
                objflag = true;
        }
    }
    for(i=0;i<bookselect.length;i++)
        {
        if(bookselect[i].checked){
                bookselectValue+=","+bookselect[i].value;
        }
    }
    if(objflag==false)
        {
        alert("你没有选择课程，请重新选课");
        return false;
        }else{
			document.getElementById("selected").submit();
		}
	}
	/*根据学分查询*/
	function all1change(){
		var redi = document.getElementById("all1").value;
		document.getElementById("selected").submit();
	}
	/*根据老师或者课程名字查询*/
	function selectbtnclick(){
		var objnameorteanameselect = document.getElementById("selectbtn1").value;
		alert(objnameorteanameselect);
		document.getElementById("selected").submit();
	}
	/* 提交结果，执行ajax */
     function pageChange(){
            var $pageChange = $("a.pageChange");//获取按钮元素
        }
        /* 页面加载完成，绑定事件 */
        $(document).ready(function(){          
            pageChange();//点击提交，执行ajax
        });
        function all1cahnge(x){
}
</script>
</head>
<body>
	<form method="post" action="selected" id="selected" >
		<div class="div_4">
			<fieldset>
				<legend>供选课程</legend>
				<table class="table table-bordered">
					<tr style="font-size:14px;">
						<th width="4%">选课</th>
						<th width="8%">课程名称</th>
						<th width="8%">课程代码</th>
						<th width="8%">教师姓名</th>
						<th width="8%">上课时间</th>
						<th width="6%">上课地点</th>
						<th width="4%">学分</th>
						<th width="6%">周学时</th>
						<th width="7%">起始结束周</th>
						<th width="4%">容量</th>
						<th width="4%">余量</th>
						<th width="6%">课程性质</th>
						<th width="8%">开课学院</th>
						<th width="8%">考试时间</th>
					</tr>
					<!--课程供选数据填充处-->
					<s:iterator value="#request.cruObjects">
					<s:if test="objnum!=null">
						<tr style="font-size: 13px">
							<s:if test="allowance>0">
							<td>
							<input type="checkbox" name="objselect" value="<s:property value="objnum"/>">
							</td>
							</s:if>
							
							<s:if test="allowance<=0">
							<td>
							<input type="checkbox"  disabled="disabled" name="objselect" value="<s:property value="objnum"/>">
							</td>
							</s:if>
							<td><s:property value="objname"/></td>
							<td><s:property value="objnum"/></td>
							<td><s:property value="teaname"/></td>
							<td><s:property value="objtime"/></td>
							<td><s:property value="place"/></td>
							<td><s:property value="credits"/></td>
							<td><s:property value="ltimes"/></td>
							<td><s:property value="objtime"/></td>
							<td><s:property value="allowance"/></td>
							<td><s:property value="capacity"/></td>
							<td>
								<s:if test="objnature=0">
									选修
								</s:if>
								<s:if test="objnature=1">
									必修
								</s:if>
							</td>
							<td><s:property value="clgname"/></td>
							<td><s:property value="examtime"/></td>
						</tr>
						</s:if>
					</s:iterator>
					<tr>
						<td colspan="7" style="font-size: 13px">第
								<s:property value="#request.PageService.currentPage"/>页/共
								<s:property value="#request.PageService.pageCount"/>页
										<s:property value="#request.PageService.recordCount"/>
									</span>节可选课程
						</td>
						<td colspan="2" style="font-size: 13px">
							<input type="button" onclick="objsubmin(this.id);" value=" 提交  " class="btn" id="objsubmit">
						</td>
						<td colspan="5" align="center" style="font-size:14px;">
							<div>
								<nav>
								  <ul class="pager"  style="margin:0px">
								    <li><a href="<s:url action="pageChange?currentPagechange=1"/>">首页</a></li>
								    <s:if test="#request.PageService.currentPage-2>0">
								    	 <li>
								    	 	<a href="<s:url action="pageChange?currentPagechange=%{#request.PageService.currentPage-2}"/>" id="li1" >
												<s:property value="#request.PageService.currentPage-2"/>
											</a>
										 </li>
								    </s:if>
								    <s:if test="#request.PageService.currentPage-1>0">
								    	 <li>
								    	 	<a href="<s:url action="pageChange?currentPagechange=%{#request.PageService.currentPage-1}"/>" id="li2" >
												<s:property value="#request.PageService.currentPage-1"/>
											</a>
										 </li>
								    </s:if>
								    <li><a><s:property value="#request.PageService.currentPage"/></a></li>
								    <s:if test="#request.PageService.currentPage+1<=#request.PageService.pageCount">
								    	 <li>
								    	 	<a href="<s:url action="pageChange?currentPagechange=%{#request.PageService.currentPage+1}"/>"  id="li3" >
												<s:property value="#request.PageService.currentPage+1"/>
											</a>
										 </li>
								    </s:if>
								     <s:if test="#request.PageService.currentPage+2<=#request.PageService.pageCount">
								    	 <li>
								    	 	<a href="<s:url action="pageChange?currentPagechange=%{#request.PageService.currentPage+2}"/>"  id="li4" >
												<s:property value="#request.PageService.currentPage+2"/>
											</a>
										 </li>
								    </s:if>
								    <li><a href="<s:url action="pageChange?currentPagechange=%{#request.PageService.pageCount}"/>">尾页</a></li>
								  </ul>
								</nav>
							</div>
						</td>
					</tr>
				</table>
			</fieldset>
		</div>


		
		<%-- <div>
		<fieldset>
			<legend style="font-size: 15px">已选课程</legend>
			<table class="table table-bordered">
				<tbody style="font-size: 14px">
					<tr>
						<td>课程名称</td>
						<td>教师姓名</td>
						<td>学分</td>
						<td>周学时</td>
						<td>起始结束周</td>
						<td>校区</td>
						<td>上课时间</td>
						<td>上课地点</td>
						<td>教材</td>
						<td>课程归属</td>
						<td>课程性质</td>
						<td>校区代码</td>
					</tr>
					<!--已选课程输出处-->
					<s:iterator>
						<tr>
						
						</tr>
					</s:iterator>
				</tbody>
			</table>
		</fieldset>
		</div>
		
		<div>
		<fieldset>
			<legend style="font-size: 15px">
				学分统计： <span id="lbl_xf"></span>
			</legend>
		</fieldset>
		</div>
	</form> --%>
	
</body>
</html>